<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>保存文件</title>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="pragma" content="no-cache">
</head>

<body>
<script language=javascript>

    function Save(){
        var txt = document.all.output.value;
        b = window.open();
        b.document.open();
        alert(document.getElementById('output').value);
        b.document.write(document.getElementById('output').value);
        b.document.close();
        b.document.execCommand('SaveAs',false,'D:/output.html');
        b.window.close();
    }

</script>



仅保存文本框中部分：
<table width="90%" align="center" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td>不保存</td>
        <td><input type="button" value="Save" class="trans" onclick="Save()">

            <textarea rows="20" cols="50" id="output" class="txtedit"></textarea>
        </td>
    </tr>
</table>
</body>
</html>